import type { UploadUserFile } from "element-plus";

export interface spuListPrams {
  page: number;
  limit: number;
  category3Id: number;
}

export interface spuItem {
  id: number;
  spuName: string;
  description: string;
  category3Id: number;
  tmId: number;
  // "spuSaleAttrList": null,
  // "spuImageList": null
}
export type spuList = spuItem[];
//响应数据
export interface getSpuRes {
  records: spuList;
  total: number;
}
// 基础销售属性
export interface BaseSaleAttrModel {
  id: number;
  name: string;
}

// 基础销售属性列表
export type BaseSaleAttrListModel = BaseSaleAttrModel[];

export interface SpuImageItem {
  id?: number;
  imgName: string;
  imgUrl: string;
}

export type SpuImageList = SpuImageItem[];

export interface SpuSaleAttrValueItem {
  baseSaleAttrId: number;
  id?: number;
  saleAttrValueName: string;
}

export type SpuSaleAttrValueList = SpuSaleAttrValueItem[];

export interface SpuSaleAttrItem {
  baseSaleAttrId: number;
  id?: number;
  saleAttrName: string;
  spuSaleAttrValueList: SpuSaleAttrValueList;
}

export type SpuSaleAttrList = SpuSaleAttrItem[];

export interface SaveOrUpdateSpuApiParams {
  category3Id: number;
  id?: number;
  spuName: string;
  tmId: number | undefined;
  description: string;
  spuImageList: SpuImageList;
  spuSaleAttrList: SpuSaleAttrList;
}

//组件使用
// const spuFormDate = reactive({
//   description: "",
//   spuImageList: [],
//   spuName: "",
//   spuSaleAttrList: [],
//   tmId: undefined,
// })

export interface SaveSpuSaleAttrItem extends SpuSaleAttrItem {
  isEdit: boolean;
}
export type spuSaleAttrList = SaveSpuSaleAttrItem[];

export interface spuFormDateType extends
 Pick<SaveOrUpdateSpuApiParams, "spuName" | "id" | "description"> {
  spuImageList: UploadUserFile[];
  spuSaleAttrList: spuSaleAttrList;
  tmId: undefined | number;
}
